home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8036 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.2 KB

  1. Path: anvil.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help: RCS and make.
  5. Date: 29 Feb 1996 08:29:02 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4h4k8eINNs0e@anvil.ugrad.cs.ubc.ca>
  8. References: <DnIDn2.8rK@world.std.com>
  9. NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
  10.  
  11. In article <DnIDn2.8rK@world.std.com>,
  12. doug a blaisdell <dougb@world.std.com> wrote:
  13.  >hi y'all--
  14.  >
  15.  >Anyone know how to get around the problem where the makefile
  16.  >has some files that are dependent on RCS: eg:
  17.  >
  18.  >foo.c: RCS/foo.c,v
  19.  >        co foo.c
  20.  >
  21.  >And you do something like:
  22.  >
  23.  >    co -l foo.c
  24.  >
  25.  >and then a:
  26.  >
  27.  >    make foo
  28.  >
  29.  >Make will call RCS to checkout foo.c again. In fact,
  30.  >every time you run make thereafter, because "co -l"
  31.  
  32. Your whole problem is that you are forcing make to compare the time stamps of
  33. temporary check-out .c files against their ,v originals.
  34.  
  35. In fact, the real dependency that you are interested in is between compiled .o
  36. files and RCS ,v files---the intermediate check-outs are completely
  37. irrelevant!!!
  38.  
  39. The only pre-condition that the make rules need to ensure is that the .c files
  40. are checked out _if they don't exist_.
  41.  
  42. The way you do this is with a rule like this:
  43.  
  44. foo.c:
  45.     co foo.c
  46.  
  47. That's it! If foo.c exists, make will treat the dependency as satisfied.
  48. If foo.c doesn't exist, it will be checked out. It will remain check out, so
  49. that running make on it will not force a re-compile of a new foo.o.
  50.  
  51. You then have the option of whether you make the foo.o dependent on the ,v file
  52. or the .c file. If you make it dependent on only the ,v file, then everytime
  53. someone does a co -l, it will force a re-compilation. However, the file will
  54. not be checked out if an old version already exists, so you will re-compile the
  55. out-of-date .c for nothing. If you keep foo.o dependent on the .c, then you
  56. will have control over what version of the project you are making. It will
  57. never check out an updated revision unless you force this by deleting one of
  58. the .c files. This is beneficial, since you probably want to use stable
  59. revisions of other people's code while working on yours.
  60.  
  61.  
  62. Hope this helps.
  63.  
  64. Now, what is your C question? ;)
  65. -- 
  66.  
  67.